<%@ page import="com.zjitc.utils.Utils" %>
<%@ page import="java.util.LinkedList" %>
<%--
  Created by IntelliJ IDEA.
  User: 毛勇琪大帅哥
  Date: 2017/11/16
  Time: 14:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!--
商品浏览记录:
-->
<div style="width:1390px;margin:0 auto; padding: 0 9px;border: 1px solid #ddd;border-top: 2px solid #999;height: 246px;">

  <h4 style="width: 20%;float: left;">浏览记录</h4>
  <div style="width: 50%;float: right;text-align: right;"></div>
  <div style="clear: both;"></div>
  <div style="overflow: hidden;height: 170px" >
    <ul style="list-style: none;">
      <%--<c:forEach items="${sessionScope.history.keys}" var="c">--%>
      <%--<li style="width: 150px;height: 216px;float: left;margin: 0 8px 0 0;padding: 0 18px 15px;text-align: center;">--%>
      <%--<a href="/displaymsg?pid=${item.value.pid}">--%>
      <%--<img src="/${item.value.image}" width="130px" height="130px" >--%>
      <%--<p class="text-center">${fn:substring(item.value.name, 0, 10)}..</p>--%>
      <%--</a>--%>
      <%--</li>--%>


      <c:forEach items="${history.products}" var="item">
        <%--<c:if test="${c == item.value.pid}">--%>
        <li style="width: 150px;height: 170px;float: left;margin: 0 8px 0 0;text-align: center;">
          <a href="${pageContext.request.contextPath}/product/displaymsg.do?pid=${item.value.pid}">
            <img src="${pageContext.request.contextPath}/${item.value.image}" width="130px"
                 height="130px">
            <p class="text-center">${fn:substring(item.value.name, 0, 5)}..</p>
          </a>
        </li>
        <%--</c:if>--%>
      </c:forEach>
      <%--</c:forEach>--%>

    </ul>


  </div>
  <h6 style="width: 100%;text-align: right" ><a href="javascript:;" onclick="delhistory()">清空记录</a></h6>
</div>


<script>
  function delhistory() {
      $.ajax({
          url:"${pageContext.request.contextPath}/product/delhistory.do",
          type:"post",
          success:function (d) {
              if(d.status == 0){
                  location.reload();
              }
          }
      })

  }
</script>